//
//  HMNavController.m
//  网易彩票01
//
//  Created by Macx on 16/2/19.
//  Copyright © 2016年 Macx. All rights reserved.
//

#import "HMNavController.h"

@interface HMNavController ()

@end

@implementation HMNavController
//当类加载的时候调用,只要使用#import导入类，就会调用类的方法

//+(void)load{
//
//}




// 当第一次使用到该类或该类的子类时调用
//The superclass implementation may be called multiple times if subclasses do not implement initialize
// 如果子类没有重写该方法，父类的该方法会被调用多次
+(void)initialize{
    if (self==[HMNavController self]) {
        
        //获得主题导航条
        UINavigationBar *navBar=[UINavigationBar appearance];
        navBar.tintColor=[UIColor whiteColor];//包含箭头等颜色
        [navBar setBackgroundImage:[UIImage imageNamed:@"NavBar64"] forBarMetrics:UIBarMetricsDefault];
        //设置导航条标题颜色
        NSMutableDictionary *attributes=[NSMutableDictionary dictionary];
        attributes[NSFontAttributeName]=HMFont(20);
        attributes[NSForegroundColorAttributeName]=[UIColor whiteColor];
        [navBar setTitleTextAttributes:attributes];
        
        //获得全局的item
        UIBarButtonItem *item=[UIBarButtonItem appearance];
        NSMutableDictionary *itemAttributes=[NSMutableDictionary dictionary];
        itemAttributes[NSFontAttributeName]=HMFont(14);
        itemAttributes[NSForegroundColorAttributeName]=[UIColor whiteColor];
        [item setTitleTextAttributes:itemAttributes forState:UIControlStateNormal];
    }

}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{

    viewController.hidesBottomBarWhenPushed=YES;
    [super pushViewController:viewController animated:animated];

}

@end
